package tcc.ctrl;

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

import tcc.model.Usuario;
import tcc.util.DataBaseCreator;

@WebServlet(urlPatterns = { "/" })
public class IndexCtrl extends HttpServlet {
	private static final long serialVersionUID = 5651358763261849436L;

	public IndexCtrl() {
		// na primeira vez que essa classe é criada ele verifica e cria as
		// tabelas e os dados iniciais do banco de dados.
		new DataBaseCreator();
	}

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {

		req.setAttribute("content", "index.jsp");
		req.setAttribute("usuario", req.getSession().getAttribute("usuario"));

		req.getRequestDispatcher("/template.jsp").forward(req, resp);
	}

}
